#include "md5.h"
#include "md5_wrapper.h"
#include <iostream>
#include <memory>
#include <string>


int main() {
  // Calculate MD5 of a string
  std::string data = "This is a test string";
  std::string md5_str;
  if (MD5Test::Md5Wrapper::calculate_string_md5(data, md5_str) != 0) {
    std::cerr << "Error calculating MD5 of string" << std::endl;
    return 1;
  }

  std::cout << "MD5 of string: " << md5_str << std::endl;

  // Calculate MD5 of a file
  std::string filename = "C:/test/example.txt";
  if (MD5Test::Md5Wrapper::calculate_file_md5(filename, md5_str) != 0) {
    std::cerr << "Error calculating MD5 of file: " << filename << std::endl;
    return 1;
  }

  std::cout << "MD5 of file: " << filename << " - " << md5_str << std::endl;

  // Check MD5 of a file against its corresponding .md5 file
  if (MD5Test::Md5Wrapper::check_md5_file(filename) != 0) {
    std::cout << "MD5 mismatch for file: " << filename << std::endl;
  } else {
    std::cout << "MD5 matches for file: " << filename << std::endl;
  }

  return 0;
}
